package com.zero.jewelry.service.Impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zero.common.core.utils.DateUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.zero.jewelry.mapper.ProdPartitionMapper;
import com.zero.jewelry.domain.ProdPartition;
import com.zero.jewelry.service.IProdPartitionService;

/**
 * 产品分区管理Service业务层处理
 *
 * @author cai-xu-kun
 * @date 2025-08-01
 */
@Service
@RequiredArgsConstructor
public class ProdPartitionServiceImpl extends ServiceImpl<ProdPartitionMapper, ProdPartition> implements IProdPartitionService {

    private final ProdPartitionMapper prodPartitionMapper;

    /**
     * 查询产品分区管理分页
     *
     * @param prodPartition 产品分区管理
     * @param p 分页数据
     * @return 产品分区管理
     */
    @Override
    public Page<ProdPartition> selectProdPartitionListPage(ProdPartition prodPartition, Page<ProdPartition> p) {
        return prodPartitionMapper.selectProdPartitionListPage(prodPartition, p);
    }

    /**
     * 查询产品分区管理
     *
     * @param id 产品分区管理主键
     * @return 产品分区管理
     */
    @Override
    public ProdPartition selectProdPartitionById(Long id) {
        return prodPartitionMapper.selectProdPartitionById(id);
    }

    /**
     * 查询产品分区管理列表
     *
     * @param prodPartition 产品分区管理
     * @return 产品分区管理
     */
    @Override
    public List<ProdPartition> selectProdPartitionList(ProdPartition prodPartition) {
        return prodPartitionMapper.selectProdPartitionList(prodPartition);
    }

    /**
     * 新增产品分区管理
     *
     * @param prodPartition 产品分区管理
     * @return 结果
     */
    @Override
    public int insertProdPartition(ProdPartition prodPartition) {
        prodPartition.setCreateTime(DateUtils.getNowDate());
        return prodPartitionMapper.insertProdPartition(prodPartition);
    }

    /**
     * 修改产品分区管理
     *
     * @param prodPartition 产品分区管理
     * @return 结果
     */
    @Override
    public int updateProdPartition(ProdPartition prodPartition) {
        prodPartition.setUpdateTime(DateUtils.getNowDate());
        return prodPartitionMapper.updateProdPartition(prodPartition);
    }

    /**
     * 批量删除产品分区管理
     *
     * @param ids 需要删除的产品分区管理主键
     * @return 结果
     */
    @Override
    public int deleteProdPartitionByIds(Long[] ids) {
        return prodPartitionMapper.deleteProdPartitionByIds(ids);
    }

    /**
     * 删除产品分区管理信息
     *
     * @param id 产品分区管理主键
     * @return 结果
     */
    @Override
    public int deleteProdPartitionById(Long id) {
        return prodPartitionMapper.deleteProdPartitionById(id);
    }
}
